
 package com.ami.kvm.jviewer.kvmpkts;
 
 import com.ami.kvm.jviewer.gui.JViewerApp;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.util.Hashtable;
 
 public class UserDataPacket
 {
   public static final int USER_DATA_LENGTH = 134;
   public static final int USER_NAME_LENGTH = 64;
   public static final int CLIENT_IP_LENGTH = 65;
   private UserData userData = null;
   private Hashtable<String, UserData> userDataTable = null;
   private int numUsers = 1;
   private String[] userInfo = null;
   
   public UserDataPacket(ByteBuffer paramByteBuffer) {
     byte[] arrayOfByte = new byte[''];
     String str = null;
     
     this.numUsers = (paramByteBuffer.capacity() / 134);
     this.userDataTable = new Hashtable();
     this.userInfo = new String[this.numUsers];
     
     for (int i = 0; i < this.numUsers; i++) {
       paramByteBuffer.get(arrayOfByte);
       this.userData = new UserData(arrayOfByte);
       str = this.userData.getSessionIndex() + " : " + this.userData.getUserName() + "( " + JViewerApp.getInstance().getIpmiPrivText(this.userData.getIpmiPriv()) + ") : " + this.userData.getClientIP();
       this.userDataTable.put(str, this.userData);
       this.userInfo[i] = str;
     }
   }
   
 
 
   public Hashtable<String, UserData> getUserDataTable()
   {
     return this.userDataTable;
   }
   
 
 
   public void setUserDataTable(Hashtable<String, UserData> paramHashtable)
   {
     this.userDataTable = paramHashtable;
   }
   
 
 
   public String[] getUserInfo()
   {
     return this.userInfo;
   }
   
 
 
   public int getNumUsers()
   {
     return this.numUsers;
   }
   
   public UserData getUserData(String paramString) {
     UserData localUserData = (UserData)this.userDataTable.get(paramString);
     return localUserData;
   }
   
   public ByteBuffer createUserDataBuffer(String paramString) {
     ByteBuffer localByteBuffer = null;
     byte[] arrayOfByte = null;
     int i = -1;
     this.userData = ((UserData)this.userDataTable.get(paramString));
     arrayOfByte = new byte[64];
     arrayOfByte = this.userData.getUserName().getBytes();
     localByteBuffer = ByteBuffer.allocate(134);
     localByteBuffer.order(ByteOrder.LITTLE_ENDIAN);
     localByteBuffer.position(0);
     localByteBuffer.put(arrayOfByte);
     for (i = localByteBuffer.position(); i < 64; i++)
       localByteBuffer.put((byte)0);
     arrayOfByte = new byte[65];
     arrayOfByte = this.userData.getClientIP().getBytes();
     localByteBuffer.put(arrayOfByte);
     for (i = localByteBuffer.position(); i < 129; i++)
       localByteBuffer.put((byte)0);
     localByteBuffer.put((byte)this.userData.getSessionIndex());
     localByteBuffer.rewind();
     return localByteBuffer;
   }
   
   class UserData {
     private String userName;
     private String clientIP;
     private int sessionIndex;
     private int ipmiPriv;
     
     public UserData(byte[] paramArrayOfByte) { ByteBuffer localByteBuffer = null;
       byte[] arrayOfByte = new byte[64];
       localByteBuffer = ByteBuffer.wrap(paramArrayOfByte);
       localByteBuffer.order(ByteOrder.LITTLE_ENDIAN);
       localByteBuffer.get(arrayOfByte);
       this.userName = new String(arrayOfByte).trim();
       arrayOfByte = new byte[65];
       localByteBuffer.get(arrayOfByte);
       this.clientIP = new String(arrayOfByte).trim();
       this.sessionIndex = localByteBuffer.get();
       this.ipmiPriv = localByteBuffer.getInt();
     }
     
 
 
     public String getUserName()
     {
       return this.userName;
     }
     
 
 
     public String getClientIP()
     {
       return this.clientIP;
     }
     
 
 
     public int getSessionIndex()
     {
       return this.sessionIndex;
     }
     
 
     public int getIpmiPriv()
     {
       return this.ipmiPriv;
     }
   }
 }


/* Location:              D:\Users\tianlin\Downloads\JViewer.jar!\com\ami\kvm\jviewer\kvmpkts\UserDataPacket.class
 * Java compiler version: 5 (49.0)
 * JD-Core Version:       0.7.1
 */